﻿<%@ Page Title="Festivals" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="FestivalList.aspx.cs" Inherits="Festival_Locator.FestivalList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">

    <script type="text/javascript">
        function getFestival(id) {
            $('#festivalContainer').slideUp();
            var proxy = new Festival_Locator.AjaxService();
            proxy.GetFestival(id, onSuccess, null, null);
            function onSuccess(result) {
                $('#festivalContainer').html(result);
                $('#festivalContainer').slideDown();
            }
        }

        $(document).ready(function () {
            $('.festivalLink').live('click', function () {
                var id = $(this).attr('href');
                getFestival(id);
                return false;
            });
        });
    </script>

    <section class="featured">
        <div class="content-wrapper">
            <hgroup class="title">
                <h1><%: Page.Title %></h1>
            </hgroup>

            <section class="featured">
                <ul>
                    <asp:ListView ID="festivalList" runat="server"
                        DataKeyNames="fest_id"
                        GroupItemCount="3" ItemType="Festival_Locator.Models.Festivals" SelectMethod="GetFestivals">
                        <EmptyDataTemplate> <!-- voor als er geen data wordt opgehaald -->
                            <table id="Table1" runat="server">
                                <tr>
                                    <td>No data was returned.</td>
                                </tr>
                            </table>
                        </EmptyDataTemplate>
                        <EmptyItemTemplate>
                            <td id="Td1" runat="server" />
                        </EmptyItemTemplate>
                        <GroupTemplate>
                            <tr id="itemPlaceholderContainer" runat="server">
                                <td id="itemPlaceholder" runat="server"></td>
                            </tr>
                        </GroupTemplate>
                        <ItemTemplate>
                            <td id="Td2" runat="server">
                                <table>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td>
                                            <a class="festivalLink" href="<%#:Item.fest_id%>">
                                                <span class="FestivalName">
                                                    <%#:Item.fest_naam%>
                                                </span>
                                            </a>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </ItemTemplate>
                        <LayoutTemplate>
                            <table id="Table2" runat="server">
                                <tr id="Tr1" runat="server">
                                    <td id="Td3" runat="server">
                                        <table id="groupPlaceholderContainer" runat="server">
                                            <tr id="groupPlaceholder" runat="server"></tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr id="Tr2" runat="server">
                                    <td id="Td4" runat="server"></td>
                                </tr>
                            </table>
                        </LayoutTemplate>
                    </asp:ListView>
                </ul>

            </section>
            <div id="festivalContainer">&nbsp;</div>
        </div>
    </section>

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
</asp:Content>
